<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="Public:meta" />
</head>
<body id="main_page">
<include file="Public:position" />
<div class="container">
    <div class="box">
        <form  enctype="multipart/form-data" id="frmConfig" method="post" action="{$Action}">    
            <div class="box-header"  id="c3"><h4>安全设置</h4></div>
            <div class="box-content">
                <table class="boxtable">
                    <tr>
                        <th  style="width:20%">后台登录目录名称</th>
                        <td>
                            <input type="text" class="textinput" style="width:80px;" name="AdminLoginName" value="{$AdminLoginName}" />
                            <span class='Caution'>不设置，将默认为：admin。如设置为admin123，后台登陆地址变为：<span style="color:blue;">http://您的网址/admin123</span></span>
                        </td>
                    </tr>
                </table>
            </div>
            
            <div class="box-header"  id="c3"><h4>信息设置</h4></div>
            <div class="box-content">
                <table class="boxtable">
                    <tr>
                        <th>前台搜索页面分页大小</th>
                        <td><input type="text" class="textinput" style="width:80px;" name="SearchPageSize" value="{$SearchPageSize}" />
                        <span class='Caution'>默认为：20条，根据显示器屏幕高度设置适当值。</span></td>
                    </tr>
                    <tr>
                        <th>前台分页条可见页码个数</th>
                        <td><input type="text" class="textinput" style="width:80px;" name="HomeRollPage" value="{$HomeRollPage}" />
                        <span class='Caution'>默认为：10条，根据显示器屏幕宽度设置适当值。</span></td>
                    </tr>
                    
                    <tr>
                        <th>后台分页大小</th>
                        <td><input type="text" class="textinput" style="width:80px;" name="ADMIN_PAGE_SIZE" value="{$AdminPageSize}" />
                        <span class='Caution'>默认为：20条，根据显示器屏幕高度设置适当值。此外，当记录数很多时，设置更大的分页大小，更容易删除所有记录</span></td>
                    </tr>
                    <tr>
                        <th>后台分页条可见页码个数</th>
                        <td><input type="text" class="textinput" style="width:80px;" name="ADMIN_ROLL_PAGE" value="{$AdminRollPage}" />
                        <span class='Caution'>默认为：30条，根据显示器屏幕宽度设置适当值。</span></td>
                    </tr>
                    <tr>
                        <th nowrap="nowrap" style="width:20%">删除记录时是否同时删除图片和附件</th>
                        <td style="width:80%"><label><input type="radio" name="AUTO_DEL_ENABLE" value="1" <eq name="AutoDelEnable" value="1">checked="checked"</eq> />是</label>
    &nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="AUTO_DEL_ENABLE" value="0" <eq name="AutoDelEnable" value="0">checked="checked"</eq> />否</label></td>
                    </tr>
                    <tr>
                        <th nowrap="nowrap">是否自动上传远程图片</th>
                        <td><label><input type="radio" name="AUTO_UPLOAD_ENABLE" value="1" <eq name="AutoUploadEnable" value="1">checked="checked"</eq> />是</label>
    &nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="AUTO_UPLOAD_ENABLE" value="0" <eq name="AutoUploadEnable" value="0">checked="checked"</eq> />否</label><span class='Caution'>启用后，将自动上传文章中的远程图片</span></td>
                    </tr>
                    <tr>
                        <th nowrap="nowrap">是否删除非站内链接</th>
                        <td><label><input type="radio" class="DelLinkEnable" name="DEL_LINK_ENABLE" value="1" <eq name="DelLinkEnable" value="1">checked="checked"</eq> />是</label>
    &nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" class="DelLinkEnable"  name="DEL_LINK_ENABLE" value="0" <eq name="DelLinkEnable" value="0">checked="checked"</eq> />否</label><span class='Caution'>启用后，将删除非站内链接，允许的站外链接除外</span></td>
                    </tr>
                    <tr class="AllowLink">
                        <th>允许的站外链接</th>
                        <td><input type="text" class="textinput" style="width:100%;" name="ALLOW_LINK" value="{$AllowLink}" />
                        <span class='Caution'>链接以竖线“|”分割，如：google.com|baidu.com</span></td>
                    </tr>
                </table>
            </div> 
                    
            <div class="box-header"  id="c3">
                <h4>百度翻译API接口设置&nbsp;&nbsp;<span style="color:blue">主要用于在"内容管理"自动对文章进行中英互译！</span></h4>
            </div>
            <div class="box-content">
                <table class="boxtable">
                    <tr>
                        <th nowrap="nowrap" style="width:20%">APP ID</th>
                        <td style="width:80%">
                        <input type="text" class="textinput w270" name="BAIDU_TRANSLATE_APPID" value="{$BaiduTranslateAppId}" />
                        <span class='Caution'>还没有API Key，点击 <a href="http://api.fanyi.baidu.com" target="_blank" style="color:blue;">http://api.fanyi.baidu.com</a> 免费申请</span>
                        </td>
                    </tr>
                    <tr>
                        <th nowrap="nowrap" style="width:20%">API Key</th>
                        <td style="width:80%">
                        <input type="text" class="textinput w270" name="BAIDU_TRANSLATE_APIKEY" value="{$BaiduTranslateApiKey}" />
                        </td>
                    </tr>
                    <tr>
                        <th>翻译测试文字（中文或英文）</th>
                        <td>
                        <div style="float:left; margin-right:5px;">
                        <input type="text" class="textinput w270" name="TranslateText" id="TranslateText" value="神马都是浮云"  /></div>
                        <a  style="float:left; "  onclick="TranslateTest()" id="btnPick" target="_blank">自动翻译测试</a>
                        &nbsp;&nbsp;<span id="tip"></span>
                        </td>
                    </tr>
                    <tr>
                        <th><span style="color:red;">说明：</span></th>
                        <td><span style="color:red;">[1]测试前请先保存API Key&nbsp;&nbsp;[2]点击"自动翻译测试"按钮开始翻译</span></td>
                    </tr>
                </table>
            </div>
            
            <div class="box-header"  id="c3">
                <h4>短信接口设置&nbsp;&nbsp;
                <span style="color:blue">可用于：手机注册、短信找回密码、订单提醒、留言提醒、反馈提醒。请在相应功能设置短信内容模板</span></h4>
            </div>
            <div class="box-content">
                <table class="boxtable">
                    <tr>
                        <th nowrap="nowrap" style="width:20%">短信接口服务商</th>
                        <td style="width:80%">
                            <select name="SMS_TYPE">
                                <option value="Huyi">短接接口服务商一</option>
                            </select>
                            <span style="color:#F30; padding-left:3px;">请联系官方客服开通短信接口！</span>
                        </td>
                    </tr>
                    <tr>
                        <th nowrap="nowrap" style="width:20%">App ID</th>
                        <td style="width:80%">
                            <input type="text" class="textinput" style="width:270px;" name="SMS_ACCOUNT" value="{$SmsAccount}" />
                            <span class='Caution'>请填写APPID，请登录短信服务商用户中心查看</span></td>
                        </td>
                    </tr>
                    <tr>
                        <th nowrap="nowrap" style="width:20%">App Key</th>
                        <td style="width:80%">
                            <input type="text" class="textinput"  style="width:270px;" name="SMS_PASSWORD" value="{$SmsPassword}" />
                            <span class='Caution'>请填写APIKEY，请登录短信服务商用户中心查看</span>
                        </td>
                    </tr>
                    <tr>
                        <th nowrap="nowrap" style="width:20%">每个IP每天最多能发送几条短信</th>
                        <td style="width:80%">
                            <input type="text" class="textinput"  style="width:50px;" maxlength="5" name="SMS_IP_MAX" value="{$SmsIpMax}" />
                            <span class='Caution'>请根据实际情况设置，默认值为：20</span>
                        </td>
                    </tr>
                    <tr>
                        <th nowrap="nowrap" style="width:20%">每个手机每天最多能发送几条短信</th>
                        <td style="width:80%">
                            <input type="text" class="textinput"  style="width:50px;" maxlength="5" name="SMS_NUM_MAX" value="{$SmsNumMax}" />
                            <span class='Caution'>请根据实际情况设置，默认值为：60</span>
                        </td>
                    </tr>
                    <tr>
                        <th nowrap="nowrap" style="width:20%">剩余短信条数</th>
                        <td style="width:80%">
                            <span id="leftnum" style="font-weight:bold;color:blue; margin-right:8px;"></span>
                            <a onclick="getLeftNum()">点击查询</a>
                        </td>
                    </tr>
                    <tr>
                        <th>手机注册验证码短信发送测试</th>
                        <td>
                            <input type="text" class="textinput" style="width:110px; float:left; " maxlength="18" name="Mobile" id="Mobile" value="" placeholder="请输入手机号码"  />
                            <span style="float:left; margin-left:10px; margin-right:3px;">验证码</span>
                            <input type="text" class="textinput" style="width:50px; float:left; " maxlength="4" name="CodeNum" id="CodeNum" value="{:rand_string(4,1)}" placeholder="验证码"  />
                            <a  style="float:left; margin-left:8px;"  onclick="sendSmsTest()" id="btnPick" target="_blank">短信发送测试</a>
                            <span style="float:left; margin-left:5px;" id="smstip"></span>
                            <span class='Caution'>发送前，请先保存设置！</span></td>
                        </td>
                    </tr>
                    <tr>
                        <th><span style="color:red;">配置步骤：</span></th>
                        <td><span style="color:red;">
                            [1] 在本后台设置全部短信模板（如：手机注册验证码模板、订单通知模板等）
                            [2] 登录短信服务商的后台，将[1]设置的模板提交审核，审核通过后才能发送相关短信！
                            </span>
                        </td>
                    </tr>
                </table>
            </div>
            
            <div class="box-footer">
                <div class="box-footer-inner">
                    <input  id="btnSubmit"  type="submit" value="保存设置" />
                </div>
            </div>
        </form>
    </div>
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
	$('#frmConfig').ajaxForm({
		success: complete,
		dataType: 'json'
	});
	
	function complete(data){
		CloseLoadBox();
		if (data.status==1){
			SucceedBox(data.info);
		}else if(data.status==0){
			ErrorBox(data.info);
		}
	};
	
	 $('#frmConfig').submit(function(){
		 LoadBox();
		return false;
	 });
	 
	 $(".DelLinkEnable").click(function(){
		ChangeAllowLink( $(this).val() );
	 });
	
	function ChangeAllowLink( type ){
		if( type == 1 ){
			$(".AllowLink").show();
		}else{
			$(".AllowLink").hide();
		}
	}

	function pageInit(){
		ChangeAllowLink('{$DelLinkEnable}');
	}
	pageInit();
});

function TranslateTest(){
	msg = "<img src='{$WebPublic}Images/loading/9.gif' border='0' align='absmiddle'/>";
	msg += "翻译中，请稍后...";
	$("#tip").html(msg);
	var content = $("#TranslateText").val();
	var timenow = new Date().getTime();
	var url = "{$Url}translateTest";
	var p = {content:$("#TranslateText").val(), t:timenow}
	$.post(url, p, function(data){
		var title = "<span style='color:blue;font-weight:bold;'>翻译结果：</span>";
		if(data.status == 1){
			$("#tip").html( title+"<span style='color:blue'>"+data.info+"</span>" );
		}else{
			$("#tip").html( title+"<span style='color:red'>"+data.info+"</span>" );
		}
	}, "json");
}

function getLeftNum(){
	var url="{$Url}getLeftNum";
	var html = "<img src='{$WebPublic}Images/loading/21.gif' border='0' align='absmiddle'/>";
	html += " 查询中，请稍后...";
	$("#leftnum").html(html);
	$.get(url,null,function(data){
		if(data.status == 1){
			$("#leftnum").html(data.info);
		}else{
			$("#leftnum").html("<b style='color:red'>"+data.info+"</b>");
		}
	},"json");
}

function sendSmsTest(){
	var mobile = $("#Mobile").val();
	if( mobile.length < 10 ){
		WarnBox("手机号码无效！");
		$("#Mobile").focus();
		return;
	}
	var code = $("#CodeNum").val();
	if( code.length != 4 ){
		WarnBox("请输入4位数的验证码！");
		$("#CodeNum").focus();
		return;
	}
	var url="{$Url}sendSmsTest/mobile/"+mobile+"/code/"+code;
	var html = "<img src='{$WebPublic}Images/loading/21.gif' border='0' align='absmiddle'/>";
	html += " 发送中，请稍后...";
	$("#smstip").html(html);
	$.get(url,null,function(data){
		if(data.status == 1){
			$("#smstip").html(data.info);
		}else{
			$("#smstip").html("<b style='color:red'>"+data.info+"</b>");
		}
	},"json");
}
</script>